//: Playground - noun: a place where people can play

import UIKit

let sex = 1;

switch sex {
case 0:
    print("0")
case 1:
    print("1")
    fallthrough
default:
    print("---")
}

// switch case默认自带了break;
// 如果需要switch case 需要加上关键字fallthrough

// switch 可以判断浮点型
let a = 3.14
switch a {
case 3.14:
    print("π")
default:
    print("other")
}

// swithc可以判断字符串
let s = "a"
switch s {
case "a":
    print("a")
default:
    print("other")
}

// switch 可以判断区间
// 开区间0..<10  闭区间0...10
let score = 80;
switch score {
case 0..<60:
    print("F")
case 60..<70:
    print("C")
case 70..<80:
    print("B")
case 80..<100:
    print("A")
default:
    print("o")
}










